/**
 * <p>Copyright: Copyright (c) 2014</p>
 * <p>Company: ---Technology Co. Ltd</p>
 * <p>2014-4-30</p>
 * @author Jan.Zhang
 */
package com.xianl.busiplat.util;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import com.xianl.busiplat.shiro.ShiroDbRealm;


/** 
 * desc:
 * <p>author: Jan.Zhang </p>
 * date: 2014-4-30
 */
public class CurrentUserUtil {
	
	public static String getCurrentUser(){
		Subject subject = SecurityUtils.getSubject();
		ShiroDbRealm.ShiroUser shiroUser = (ShiroDbRealm.ShiroUser) subject.getPrincipal();
		if(shiroUser != null){
			return shiroUser.getLoginName();
		}
		return null;
	}
}
